//
//  AppDelegate.m
//  LvXi_newVersion
//
//  Created by 诸葛孔明 on 16/8/9.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "AppDelegate.h"

#import "LXGuideTool.h"



@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [self setUpIQKeyboard];
    [WXApi registerApp:WeiXin_AppKey withDescription:@"绿稀全球购"];
    self.window = [[UIWindow alloc] initWithFrame:ScreenBounds];
    self.window.backgroundColor = [UIColor whiteColor];
   
    [LXGuideTool chooseRootViewController:self.window];
    [self.window makeKeyAndVisible];

    NSLog(@"/*************沙盒目录*************/");
    NSLog(@"%@",NSHomeDirectory());
    NSLog(@"/*************沙盒目录*************/");
    
    
    return YES;
}


/**
 *  智能键盘管理
 */
-(void)setUpIQKeyboard{
    IQKeyboardManager * manager = [IQKeyboardManager sharedManager];
    manager.enable = YES;
    manager.enableAutoToolbar = NO;
    manager.shouldResignOnTouchOutside = YES;
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
    [TencentOAuth HandleOpenURL:url];
    [WXApi handleOpenURL:url delegate:[WXApiManager sharedManager]];
    [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
    }];
    return YES;
    
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
    [WXApi handleOpenURL:url delegate:[WXApiManager sharedManager]];
    [TencentOAuth HandleOpenURL:url];
    [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
    }];
    return YES;
    
}

-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
    if(self.isLandscape){
        return UIInterfaceOrientationMaskLandscape;
    }else if (self.isPortrai){
        return UIInterfaceOrientationMaskPortrait;
    }
    return UIInterfaceOrientationMaskPortrait;
}

@end
